# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=packetsender
pkgver=1191.55fb033
pkgrel=1
groups=('blackarch' 'blackarch-networking')
pkgdesc='An open source utility to allow sending and receiving TCP and UDP packets.'
arch=('x86_64' 'aarch64')
url='https://github.com/dannagle/PacketSender'
license=('GPL2')
depends=('openssl' 'qt5-base' 'libxcb' 'libcap' 'libgcrypt' 'libpng' 'glib2')
makedepends=('git')
source=("$pkgname::git+https://github.com/dannagle/PacketSender.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd "$pkgname/src"

  qmake PacketSender.pro

  make
}

package() {
  cd $pkgname

  install -Dm 755 "src/$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/screenshots/" screenshots/*
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

